﻿namespace TheSafety.Dialogs
{
    using Agent;
    using System;
    using System.CodeDom.Compiler;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Markup;

    [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
    public class ChangePasswordVPN : Window, IComponentConnector
    {
        private string a = "";
        internal Label b;
        internal Label c;
        internal Label d;
        internal PasswordBox e;
        internal Label f;
        internal PasswordBox g;
        internal Button h;
        internal Button i;
        private bool j;

        public ChangePasswordVPN()
        {
            this.InitializeComponent();
            this.a();
            this.e.Focus();
        }

        private void a()
        {
            this.d.Content = e.c("NewPassword");
            this.f.Content = e.c("RetypeNewPassword");
            this.b.Content = e.c("VPNUsername") + ": ";
            this.i.Content = e.c("Cancel");
            base.Title = e.c("ChangePasswordVPNTitle");
        }

        [DebuggerNonUserCode, EditorBrowsable(EditorBrowsableState.Never)]
        private void a(int A_0, object A_1)
        {
            switch (A_0)
            {
                case 1:
                    this.b = (Label) A_1;
                    return;

                case 2:
                    this.c = (Label) A_1;
                    return;

                case 3:
                    this.d = (Label) A_1;
                    return;

                case 4:
                    this.e = (PasswordBox) A_1;
                    return;

                case 5:
                    this.f = (Label) A_1;
                    return;

                case 6:
                    this.g = (PasswordBox) A_1;
                    return;

                case 7:
                    this.h = (Button) A_1;
                    this.h.Click += new RoutedEventHandler(this.btnOk_Click);
                    return;

                case 8:
                    this.i = (Button) A_1;
                    this.i.Click += new RoutedEventHandler(this.btnCancel_Click);
                    return;
            }
            this.j = true;
        }

        private void btnCancel_Click(object A_0, RoutedEventArgs A_1)
        {
            base.Close();
        }

        private void btnOk_Click(object A_0, RoutedEventArgs A_1)
        {
            if (!string.IsNullOrWhiteSpace(this.e.Password) && (this.e.Password == this.g.Password))
            {
                if (WebRequestManager.a(this.a, this.e.Password))
                {
                    MessageBox.Show(e.c("Password VPN was changed successfully. New Password VPN will be updated on server within 30 minutes."));
                }
                else
                {
                    MessageBox.Show(e.c("PasswordChangingNotSucceed"));
                }
                base.Close();
            }
            else
            {
                MessageBox.Show(e.c("PasswordsAreNotEqual"));
            }
        }

        [DebuggerNonUserCode]
        public void InitializeComponent()
        {
            if (!this.j)
            {
                this.j = true;
                Uri resourceLocator = new Uri("/TheSafety;component/dialogs/changepasswordvpn.xaml", UriKind.Relative);
                Application.LoadComponent(this, resourceLocator);
            }
        }

        public string usernameVPN
        {
            get
            {
                return this.a;
            }
            set
            {
                this.c.Content = value;
                this.a = value;
            }
        }
    }
}

